package main;

import java.io.File;
import java.util.Comparator;

/**
 * Reverses the file order.  Files must only have a numerical number as a name
 * in order to work.  
 * @author Brad
 *
 */
public class FileComparator implements Comparator<File> {
	
	/**
	 * Reverses the file order.  Files must only have a numerical number as a name
	 * 	in order to work.  
	 */
	@Override
	public int compare(File f1, File f2) {
		int i1 = Integer.parseInt(f1.getName());
		int i2 = Integer.parseInt(f2.getName());
		if(i1 == i2) return 0;
		return (i1 > i2) ? -1 : 1;
	}
}
